3.527 \(\int \cos (c+d x) (a+b \tan (c+d x))^2 \, dx\)

Optimal. Leaf size=47 \[ \frac{\left (a^2-b^2\right ) \sin (c+d x)}{d}-\frac{2 a b \cos (c+d x)}{d}+\frac{b^2 \tanh ^{-1}(\sin (c+d x))}{d} \]

[Out]

(b^2*ArcTanh[Sin[c + d*x]])/d - (2*a*b*Cos[c + d*x])/d + ((a^2 - b^2)*Sin[c + d*x])/d

________________________________________________________________________________________

Rubi [A]  time = 0.0332454, antiderivative size = 47, normalized size of antiderivative = 1., number of steps used = 1, number of rules used = 1, integrand size = 19, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.053, Rules used = {3507} \[ \frac{\left (a^2-b^2\right ) \sin (c+d x)}{d}-\frac{2 a b \cos (c+d x)}{d}+\frac{b^2 \tanh ^{-1}(\sin (c+d x))}{d} \]

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]*(a + b*Tan[c + d*x])^2,x]

[Out]

(b^2*ArcTanh[Sin[c + d*x]])/d - (2*a*b*Cos[c + d*x])/d + ((a^2 - b^2)*Sin[c + d*x])/d

Rule 3507

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^2/sec[(e_.) + (f_.)*(x_)], x_Symbol] :> Simp[(b^2*ArcTanh[Sin[e + f
*x]])/f, x] + (-Simp[(2*a*b*Cos[e + f*x])/f, x] + Simp[((a^2 - b^2)*Sin[e + f*x])/f, x]) /; FreeQ[{a, b, e, f}
, x] && NeQ[a^2 + b^2, 0]

Rubi steps

\begin{align*} \int \cos (c+d x) (a+b \tan (c+d x))^2 \, dx &=\frac{b^2 \tanh ^{-1}(\sin (c+d x))}{d}-\frac{2 a b \cos (c+d x)}{d}+\frac{\left (a^2-b^2\right ) \sin (c+d x)}{d}\\ \end{align*}

Mathematica [A]  time = 0.138971, size = 84, normalized size = 1.79 \[ \frac{\left (a^2-b^2\right ) \sin (c+d x)-2 a b \cos (c+d x)+b^2 \left (\log \left (\sin \left (\frac{1}{2} (c+d x)\right )+\cos \left (\frac{1}{2} (c+d x)\right )\right )-\log \left (\cos \left (\frac{1}{2} (c+d x)\right )-\sin \left (\frac{1}{2} (c+d x)\right )\right )\right )}{d} \]

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]*(a + b*Tan[c + d*x])^2,x]

[Out]

(-2*a*b*Cos[c + d*x] + b^2*(-Log[Cos[(c + d*x)/2] - Sin[(c + d*x)/2]] + Log[Cos[(c + d*x)/2] + Sin[(c + d*x)/2
]]) + (a^2 - b^2)*Sin[c + d*x])/d

________________________________________________________________________________________

Maple [A]  time = 0.046, size = 63, normalized size = 1.3 \begin{align*}{\frac{{b}^{2}\ln \left ( \sec \left ( dx+c \right ) +\tan \left ( dx+c \right ) \right ) }{d}}+{\frac{{a}^{2}\sin \left ( dx+c \right ) }{d}}-{\frac{\sin \left ( dx+c \right ){b}^{2}}{d}}-2\,{\frac{ab\cos \left ( dx+c \right ) }{d}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)*(a+b*tan(d*x+c))^2,x)

[Out]

1/d*b^2*ln(sec(d*x+c)+tan(d*x+c))+a^2*sin(d*x+c)/d-1/d*sin(d*x+c)*b^2-2*a*b*cos(d*x+c)/d

________________________________________________________________________________________

Maxima [A]  time = 1.38506, size = 81, normalized size = 1.72 \begin{align*} \frac{b^{2}{\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right ) - 2 \, \sin \left (d x + c\right )\right )} - 4 \, a b \cos \left (d x + c\right ) + 2 \, a^{2} \sin \left (d x + c\right )}{2 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a+b*tan(d*x+c))^2,x, algorithm="maxima")

[Out]

1/2*(b^2*(log(sin(d*x + c) + 1) - log(sin(d*x + c) - 1) - 2*sin(d*x + c)) - 4*a*b*cos(d*x + c) + 2*a^2*sin(d*x
 + c))/d

________________________________________________________________________________________

Fricas [A]  time = 1.80178, size = 155, normalized size = 3.3 \begin{align*} -\frac{4 \, a b \cos \left (d x + c\right ) - b^{2} \log \left (\sin \left (d x + c\right ) + 1\right ) + b^{2} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \,{\left (a^{2} - b^{2}\right )} \sin \left (d x + c\right )}{2 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a+b*tan(d*x+c))^2,x, algorithm="fricas")

[Out]

-1/2*(4*a*b*cos(d*x + c) - b^2*log(sin(d*x + c) + 1) + b^2*log(-sin(d*x + c) + 1) - 2*(a^2 - b^2)*sin(d*x + c)
)/d

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \left (a + b \tan{\left (c + d x \right )}\right )^{2} \cos{\left (c + d x \right )}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a+b*tan(d*x+c))**2,x)

[Out]

Integral((a + b*tan(c + d*x))**2*cos(c + d*x), x)

________________________________________________________________________________________

Giac [B]  time = 1.94314, size = 1777, normalized size = 37.81 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a+b*tan(d*x+c))^2,x, algorithm="giac")

[Out]

-1/2*(b^2*log(2*(tan(1/2*c)^2 + 1)/(tan(1/2*d*x)^4*tan(1/2*c)^2 + 2*tan(1/2*d*x)^4*tan(1/2*c) + 2*tan(1/2*d*x)
^3*tan(1/2*c)^2 + tan(1/2*d*x)^4 + 2*tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)^3 + 2*tan(1/2*d*x)*tan(1/2*c
)^2 + 2*tan(1/2*d*x)^2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 2*tan(1/2*c) + 1))*tan(1/2*d*x)^2*tan(1/2*c)^2 - b^2*
log(2*(tan(1/2*c)^2 + 1)/(tan(1/2*d*x)^4*tan(1/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